package com.aidong.util;

/**
 * Created by john on 16-11-2.
 */
import java.io.File;
import org.apache.log4j.Logger;

public class FileCheckUtil {
    private static Logger log = Logger.getLogger(FileCheckUtil.class);

    public FileCheckUtil() {
    }

    public static boolean checkFilePath(String filePath) {
        File dir = new File(filePath);
        if(dir.exists()) {
            return false;
        } else {
            if(!filePath.endsWith(File.separator)) {
                filePath = filePath + File.separator;
            }

            if(dir.mkdirs()) {
                log.info("创建目录" + filePath + "成功！");
                return true;
            } else {
                log.error("创建目录" + filePath + "失败！");
                return false;
            }
        }
    }
}
